package com.qmth.gkwb.data.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 考生信息
 * @author zhengmin
 *
 */
@Entity
@Table(name="bk_ks")
public class BKKS implements Serializable {

	@Transient private final String ART = "13,17";
	@Transient private final String SPORT = "14,18";
	
	private static final long serialVersionUID = 2518157973628802327L;

	@Id
	@Column(name="ksid")
	private long id;
	
	@Column(name="ks_xm")
	private String name;
	
	@Column(name="ks_zjno")
	private String certino;
	
	@Column(name="ks_mzid")
	private Long nationId;
	
	@Column(name="ks_xbid")
	private Integer gender;
	
	@Column(name="ks_zzmmid")
	private Long polityId;
	
	@Column(name="ks_bjid")
	private Long classId;
	
	@Column(name="ks_wyyzid")
	private Long foreignId;
	
	@Column(name="ks_fzr")
	private String teacher;
	
	@Column(name="ks_tcms")
	private String special;
	
	@Column(name="ks_jfms")
	private String honer;
	
	@Column(name="ks_sfcjks")
	private int isExam = 1;
	
	@Column(name="ks_csrq")
	private String birth;
	
	@Column(name="ks_xjno")
	private String stuID;
	
	@Column(name="ks_hksfid")
	private Long censusProvId;
	
	@Column(name="ks_hkcsid")
	private Long censusCityId;
	
	@Column(name="ks_hkxqid")
	private Long censusRegionId;
	
	@Column(name="ks_sjr")
	private String receive;
	
	@Column(name="ks_sjrdz")
	private String address;
	
	@Column(name="ks_sjryzbm")
	private String zipcode;
	
	@Column(name="ks_sfks")
	private int isJoinExam = 1;
	
	@Column(name="ks_xxid")
	private Long schoolId;
	
	@Column(name="ks_byxxid")
	private Long gradSchoolId;//毕业学校
	
	@Column(name="ks_klid")
	private Long subjectId;//科类
	
	@Column(name="ks_kslblxid")
	private Long periodId;//考生类别类型
	
	@Column(name="ks_kslbid")
	private Long stuTypeId;//考生类型
	
	@Transient
	private DictExamType examType;//考试类型：全通统考、技能高考等
	
	@Transient
	private DictSubject subject;//科类
	
	@Transient
	private DictSignPoint signPoint;//报名点
	
	@Transient
	private School gradSchool;//毕业学校
	
	@Transient
	private String subjectType;//科类类型：艺术或体育

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Long getSchoolId() {
		return schoolId;
	}

	public void setSchoolId(Long schoolId) {
		this.schoolId = schoolId;
	}

	public Long getGradSchoolId() {
		return gradSchoolId;
	}

	public void setGradSchoolId(Long gradSchoolId) {
		this.gradSchoolId = gradSchoolId;
	}

	public Long getSubjectId() {
		return subjectId;
	}

	public void setSubjectId(Long subjectId) {
		this.subjectId = subjectId;
	}

	public Long getPeriodId() {
		return periodId;
	}

	public void setPeriodId(Long periodId) {
		this.periodId = periodId;
	}

	public Long getStuTypeId() {
		return stuTypeId;
	}

	public void setStuTypeId(Long stuTypeId) {
		this.stuTypeId = stuTypeId;
	}

	public DictSubject getSubject() {
		return subject;
	}

	public void setSubject(DictSubject subject) {
		this.subject = subject;
	}

	public DictSignPoint getSignPoint() {
		return signPoint;
	}

	public void setSignPoint(DictSignPoint signPoint) {
		this.signPoint = signPoint;
	}

	public School getGradSchool() {
		return gradSchool;
	}

	public void setGradSchool(School gradSchool) {
		this.gradSchool = gradSchool;
	}

	public DictExamType getExamType() {
		String str = String.valueOf(this.id);
		int examTypeCode = Integer.parseInt(String.valueOf(str.charAt(8)));
		switch(examTypeCode){
		case 1:
			this.examType = new DictExamType(1, "全国统考");
			break;
		case 8:
			this.examType = new DictExamType(3, "技能高考");
			break;
		case 9:
			this.examType = new DictExamType(4, "高职单招");
			break;
			default:
				this.examType = new DictExamType(1, "全国统考");
		}
		return examType;
	}

	public void setExamType(DictExamType examType) {
		this.examType = examType;
	}

	public String getSubjectType() {
		String str = String.valueOf(this.id).substring(8, 10);
		if(this.ART.contains(str)){
			this.subjectType = "ART";
		}
		else if(this.SPORT.contains(str)){
			this.subjectType = "SPORT";
		}
		return subjectType;
	}

	public void setSubjectType(String subjectType) {
		this.subjectType = subjectType;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCertino() {
		return certino;
	}

	public void setCertino(String certino) {
		this.certino = certino;
	}

	public long getNationId() {
		return nationId;
	}

	public void setNationId(Long nationId) {
		this.nationId = nationId;
	}

	public Integer getGender() {
		return gender;
	}

	public void setGender(Integer gender) {
		this.gender = gender;
	}

	public long getPolityId() {
		return polityId;
	}

	public void setPolityId(Long polityId) {
		this.polityId = polityId;
	}

	public Long getClassId() {
		return classId;
	}

	public void setClassId(Long classId) {
		this.classId = classId;
	}

	public Long getForeignId() {
		return foreignId;
	}

	public void setForeignId(Long foreignId) {
		this.foreignId = foreignId;
	}

	public String getTeacher() {
		return teacher;
	}

	public void setTeacher(String teacher) {
		this.teacher = teacher;
	}

	public String getSpecial() {
		return special;
	}

	public void setSpecial(String special) {
		this.special = special;
	}

	public String getHoner() {
		return honer;
	}

	public void setHoner(String honer) {
		this.honer = honer;
	}

	public int getIsExam() {
		return isExam;
	}

	public void setIsExam(int isExam) {
		this.isExam = isExam;
	}

	public String getBirth() {
		if(this.certino != null){
			birth = certino.substring(6, 14);
		}
		return birth;
	}

	public void setBirth(String birth) {
		this.birth = birth;
	}

	public String getStuID() {
		return stuID;
	}

	public void setStuID(String stuID) {
		this.stuID = stuID;
	}

	public long getCensusProvId() {
		return censusProvId;
	}

	public void setCensusProvId(Long censusProvId) {
		this.censusProvId = censusProvId;
	}

	public Long getCensusCityId() {
		return censusCityId;
	}

	public void setCensusCityId(Long censusCityId) {
		this.censusCityId = censusCityId;
	}

	public Long getCensusRegionId() {
		return censusRegionId;
	}

	public void setCensusRegionId(Long censusRegionId) {
		this.censusRegionId = censusRegionId;
	}

	public String getReceive() {
		return receive;
	}

	public void setReceive(String receive) {
		this.receive = receive;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getZipcode() {
		return zipcode;
	}

	public void setZipcode(String zipcode) {
		this.zipcode = zipcode;
	}

	public int getIsJoinExam() {
		return isJoinExam;
	}

	public void setIsJoinExam(int isJoinExam) {
		this.isJoinExam = isJoinExam;
	}

	public static void main(String[] args){
		String str = "420107198208300518";
		System.out.println(str.substring(6,14));
	}
	
	
}
